import request from '@/utils/request'

// 查询文件列表
export function listFiles(query) {
  return request({
    url: '/declaration/files/list',
    method: 'get',
    params: query
  })
}

// 查询文件详细
export function getFiles(fId) {
  return request({
    url: '/declaration/files/' + fId,
    method: 'get'
  })
}

// 新增文件
export function addFiles(data) {
  return request({
    url: '/declaration/files',
    method: 'post',
    data: data
  })
}

// 修改文件
export function updateFiles(data) {
  return request({
    url: '/declaration/files',
    method: 'put',
    data: data
  })
}

// 删除文件
export function delFiles(fId) {
  return request({
    url: '/declaration/files/' + fId,
    method: 'delete'
  })
}

// 导出文件
export function exportFiles(query) {
  return request({
    url: '/declaration/files/export',
    method: 'get',
    params: query
  })
}

// 下载文件
export function downloadFile(fileName) {
  return request({
    //url: '/common/download?fileName='+fileName+'&fileRealPath='+fileRealPath,
    url: '/common/download/resource',
    method: 'get',
    params:{name:fileName}
    //data: {fileName:fileName,fileRealPath:fileRealPath,delete:false},
    //params: {"fileName":"'"+fileName+"'","fileRealPath":"'"+fileRealPath+"'","delete":false},
    //headers:{
    //    'Authorization':""
    //  'Accept':"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
    //  'content-disposition':"attachment;filename=total.xls",
    //  'content-type':"application/x-download;charset=utf-8",
    //  'Authorization':"",
    //},
    //responseType:'blob',
    //}
  })
}